package util

import (
	"github.com/gorilla/websocket"
	"net/http"
)

//创建Websocket连接
func NewWebsocketConn(validate bool, write http.ResponseWriter, request *http.Request) (*websocket.Conn, error)  {
	return (&websocket.Upgrader{
		CheckOrigin: func(r *http.Request) bool {
			return validate
		},
	}).Upgrade(write, request, nil)
}